//---------------------------------------------------------------------------
#ifndef TD_MainH
#define TD_MainH
//---------------------------------------------------------------------------

#include "Globals.h"

#include <Forms.hpp>

#include <Classes.hpp>
#include <ComCtrls.hpp>
#include <Controls.hpp>
#include <Dialogs.hpp>
#include <ExtCtrls.hpp>
#include <Menus.hpp>
#include <StdCtrls.hpp>

#define KEYDOWN( x ) (GetAsyncKeyState(x) & 0x8000)

//---------------------------------------------------------------------------
class TmyForm : public TForm
{
__published:	// IDE-managed Components
  TPaintBox *Video;
  TMainMenu *MainMenu1;
  TMenuItem *File1;
  TMenuItem *OpenBinaryTextData1;
  TMenuItem *N1;
  TMenuItem *SaveTextFile1;
  TMenuItem *Exit1;
  TOpenDialog *Open1;
  TSaveDialog *Save1;

  TMenuItem *LoadDataFile;
  TStatusBar *StatusBar1;
  TMenuItem *N2;
  TFindDialog *Find1;
  TMenuItem *View1;
  TMenuItem *DisplayTextEditor1;
  TMenuItem *N3;
  TMenuItem *HideCodes;
  TMenuItem *UseVWFRoutine1;
  TMenuItem *DTT;
  TMenuItem *N4;
  TMenuItem *DefaultWindowSize1;
  TMenuItem *ViewHexData1;
  TMenuItem *DecompresstoFiles1;
  TMenuItem *Program1;
  TMenuItem *DumpMemory1;
  TSaveDialog *FSave;
  TMenuItem *TextboxColor1;
  TMenuItem *Blue1;
  TMenuItem *Green1;
  TMenuItem *Red1;
  TMenuItem *N5;
  TMenuItem *Solid1;
  TMenuItem *Gradient1;
  TMenuItem *Window1;
  TMenuItem *Zoominx11;
  TMenuItem *DisplayKanaTextDump1;
  TMenuItem *N6;
  TMenuItem *TEOnTop;
  TMenuItem *SaveRomFile1;
  TMenuItem *Edit1;
  TMenuItem *InsertTextFiletoRom1;
  TListBox *ptrBox;
  TMenuItem *LoadTableFile1;
 TMenuItem *N7;
 TMenuItem *InsertCOMPRESSIONintROM1;
 TMenuItem *PATCHRomFile1;
 TMenuItem *DumpKanatoafile1;
 TMenuItem *ViewKanaDump1;
  void __fastcall OpenBinaryTextData1Click(TObject *Sender);
  void __fastcall SaveTextFile1Click(TObject *Sender);
  void __fastcall Exit1Click(TObject *Sender);
  void __fastcall LoadDataFileClick(TObject *Sender);
  void __fastcall FormCreate(TObject *Sender);
  void __fastcall FormClose(TObject *Sender, TCloseAction &Action);

  void __fastcall VideoPaint(TObject *Sender);
  void __fastcall pListClick(TObject *Sender);
  void __fastcall bListClick(TObject *Sender);
  void __fastcall Find1Find(TObject *Sender);
  void __fastcall DisplayTextEditor1Click(TObject *Sender);

  void __fastcall HideCodesClick(TObject *Sender);
  void __fastcall UseVWFRoutine1Click(TObject *Sender);
  void __fastcall DTTClick(TObject *Sender);
  void __fastcall DefaultWindowSize1Click(TObject *Sender);
  void __fastcall ViewHexData1Click(TObject *Sender);

  void __fastcall DecompresstoFiles1Click(TObject *Sender);
  void __fastcall DumpMemory1Click(TObject *Sender);

  void __fastcall Red1Click(TObject *Sender);

  void __fastcall Zoominx11Click(TObject *Sender);
  void __fastcall DisplayKanaTextDump1Click(TObject *Sender);
  void __fastcall FormResize(TObject *Sender);
  void __fastcall TEOnTopClick(TObject *Sender);

  void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);

  void __fastcall SaveRomFile1Click(TObject *Sender);
  void __fastcall InsertTextFiletoRom1Click(TObject *Sender);
  void __fastcall LoadTableFile1Click(TObject *Sender);
 void __fastcall InsertCOMPRESSIONintROM1Click(TObject *Sender);
 void __fastcall PATCHRomFile1Click(TObject *Sender);
 void __fastcall DumpKanatoafile1Click(TObject *Sender);
 void __fastcall ViewKanaDump1Click(TObject *Sender);
private:	// User declarations
public:		// User declarations
  __fastcall TmyForm(TComponent* Owner);

  void __fastcall DrawText( int  skip, int height, int width, LONG fnPosition );
  long __fastcall GetCurLine( long valu );
  long __fastcall Decompress( LONG  index );
  long __fastcall Text2Raw( int  index );
  void __fastcall TableLoader( char *tblFile );
  void __fastcall Compress(TObject *Sender);  

};

//---------------------------------------------------------------------------
extern PACKAGE TmyForm *myForm;
//---------------------------------------------------------------------------
#endif
